#ifndef _PARTHUS_UT_ATS_HCI_TRANSPORT_H
#define _PARTHUS_UT_ATS_HCI_TRANSPORT_H
/**************************************************************************
 * MODULE NAME:    ut_ats_hci_transport.h
 * PROJECT CODE:   
 * DESCRIPTION:    Support for verifying HCI tranports
 * MAINTAINER:     John Nelson
 * DATE:           6 July 2002
 *
 * SOURCE CONTROL: $Id: ut_ats_hci_transport.h,v 1.2 2009/02/25 10:55:12 tianwq Exp $
 *
 * LICENSE:
 *     This source code is copyright (c) 2002-2004 Ceva Inc.
 *     All rights reserved.
 *
 * REVISION HISTORY:
 *
 * SOURCE:
 *
 * ISSUES:
 *
 * NOTES TO USERS:
 **************************************************************************/
#include "tra_queue.h"
/*
 * Queue types and numbers and definitions defined in tra_queue.h
 * The "table" is delimeted by TRA_QUEUE_TOTAL_NUM_QUEUES, which has the correct
 * value for dimensioning the queue array due to HCI_COMMAND_Q starting at zero
 */

typedef t_q_descr * (*t_UTtra_Dequeue_Next_fp)(
    u_int8 q_type, t_deviceIndex device_index);
typedef void (*t_UTtra_Ack_Last_Dequeued_fp)(
    u_int8 q_type, t_deviceIndex device_index, t_length length);
typedef void (*t_UTtra_Tx_HCI_Packet_To_HC_fp)(
    u_int8 q_type, const u_int8 *p_data, u_int32 length);


/*
 * UART Transport specific
 */
void UTtra_HCIT_UART_Tx_Packet_To_HC(
    u_int8 q_type, const u_int8 *p_pdu, u_int32 length);


/*
 * Host equivalent Transport Queues
 */
void UTtra_Initialise(u_int8 tra_type);

void UTtra_Initialise_Queues(void);

void UTtra_Reset(t_deviceIndex device_index);
boolean UTtra_Is_Queue_Empty(u_int8 q_type, t_deviceIndex device_index);
boolean UTtra__Is_Queue_Not_Full(u_int8 q_type, t_deviceIndex device_index);
t_q_descr *UTtra_Enqueue(u_int8 q_type, t_deviceIndex device_index, t_length);
void UTtra_Commit(u_int8 q_type, t_deviceIndex device_index);
t_q_descr *UTtra_Dequeue_Next(u_int8 q_type, t_deviceIndex device_index);
t_q_descr *UTtra_Dequeue_Next_Data_By_Length(
    u_int8 q_type, t_deviceIndex device_index, u_int16 max_packet_length);
void UTtra_Ack_Last_Dequeued(
    u_int8 q_type, t_deviceIndex device_index, t_length length);


/*
 * Flow control operations
 */
u_int16 UTtra_Get_Total_Number_Of_Processed_Chunks(u_int8 q_type);
u_int16 UTtra_Get_Queue_Number_Of_Processed_Chunks(
    u_int8 q_type, t_deviceIndex device_index);
u_int16 UTtra_Get_and_Reset_Queue_Number_Of_Processed_Chunks(
    u_int8 q_type, t_deviceIndex device_index);
void UTtra_Reduce_Queue_Number_Of_Processed_Chunks(
    u_int8 q_type, t_deviceIndex device_index, u_int16 reduction);

#if (PRH_BS_CFG_SYS_SYN_VIA_HCI_SUPPORTED==0)
/*
 * For test purposes, create the SCO queue identifiers (note there are 
 * no queues associated with these on HC side)
 */
#define  SCO_IN_Q      (L2CAP_OUT_Q + MAX_ACTIVE_DEVICE_LINKS + 1)
#define  SCO_OUT_Q     (SCO_IN_Q + PRH_BS_CFG_SYS_MAX_SYN_LINKS_VIA_ACL)
#endif

/*
 * The Host HCI side transport number of queues (always include SCO queues)
 */
#define  UTTRA_QUEUE_TOTAL_NUM_QUEUES (SCO_OUT_Q + PRH_BS_CFG_SYS_MAX_SYN_LINKS_VIA_ACL)


#endif /* _PARTHUS_UT_ATS_HCI_TRANSPORT_H */
